package array;

import java.util.ArrayList;
import java.util.List;

/*
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.

    Example 1:

        Input:
        [
         [ 1, 2, 3 ],
         [ 4, 5, 6 ],
         [ 7, 8, 9 ]
        ]
        Output: [1,2,3,6,9,8,7,4,5]

    Example 2:

        Input:
        [
          [1, 2, 3, 4],
          [5, 6, 7, 8],
          [9,10,11,12]
        ]
        Output: [1,2,3,4,8,12,11,10,9,5,6,7]
 */
public class SpiralOrder {

    /*
      解题思路：找出数组的规律，
     */
    public List<Integer> spiralOrder2(int[][] matrix) {

        List<Integer> result = new ArrayList<>();
        int up = -1; //上
        int down = matrix.length;; //下
        int left = -1;//左
        int right = matrix[0].length;//右
        int c=0,r=0;
        int row = matrix.length;
        int col = matrix[0].length;

        for(int i=0;i<row*col;i++){

        }



        return result;
    }
}
